<?php
class gioithieu extends CI_Controller
{
	function __construct()
	{
		parent::__construct();	
		$this->load->config('config_gioithieu');
	}
	
	function index()
	{
		$data['title']="Cập nhật thông tin giới thiệu";
		if(isset($_POST['bt_submit']))
		{
			$this->create_gioithieu() ;
			redirect('gioithieu');
		}
		
		$this->_templates['page'] = 'gioithieu/edit';
		$this->site->load($this->_templates['page'],$data);
	
	}
	
	function create_gioithieu()
	{
		$str = "<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');\n/**\n* Cache file for config_gioithieu cafenika.com.\n* Date: ".date('d/m/y H:i:s').".\n**/";
		
		$str .= "\n";
		$str .= "\n\$config['title_gioithieu'] = '".htmlspecialchars($this->input->post('lb_subject'),ENT_QUOTES,'UTF-8')."' ;";
		$str .= "\n"; 
		$str .= "\n\$config['images_gioithieu'] = '".htmlspecialchars($this->input->post('lb_images'),ENT_QUOTES,'UTF-8')."' ;";
		$str .= "\n"; 
		$str .= "\n\$config['gioithieu'] = '".htmlspecialchars($this->input->post('lb_content'),ENT_QUOTES,'UTF-8')."' ;";
		$str .= "\n"; 
		
		$str .= "\n\n/* End of file config_gioithieu nika.com*/\n/* Location: ./cf/config_gioithieu.php */\n\n?>";        
		write_file('../cf/config_gioithieu.php', $str);
	}
}


?>